package com.sto.stoapp.manager;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;

import com.sto.stoapp.db.StoDataBaseOperation;
import com.sto.stoapp.status.EnumTableNames;

/**
 * 统计图片个数
 * 
 * @author hb
 * 
 */
public class UnSentPictureManager {
	private static UnSentPictureManager unSentDataManager;
	private int unSent = 0;

	@SuppressWarnings("null")
	public static UnSentPictureManager getInstance(Context context) {
		try {
			if (unSentDataManager == null) {
				unSentDataManager = new UnSentPictureManager();
				List<EnumTableNames> pictureStatus = new ArrayList<EnumTableNames>();
				pictureStatus.add(EnumTableNames.STATUS_TABLE_SALESMAN_SIGN);
				pictureStatus.add(EnumTableNames.STATUS_TABLE_PROBLEM);
				for (EnumTableNames status : pictureStatus) {
					unSentDataManager.unSent += StoDataBaseOperation
							.getInstance(context)
							.StatisticsPictureCount(status);
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

		return unSentDataManager;

	}

	/** 设置未发数据 **/
	public void setUnSent(int count) {
		unSent = count;
	}

	/** 获取未发数据 **/
	public int getUnSent() {
		return unSent;

	}

	/** 增加一条 **/
	public void addPictureCount() {
		unSent += 1;
	}

	/** 删除一票数据 **/
	public void deletePictureCount() {
		unSent -= 1;
	}
}
